/**
 * @project_name staff_vehicle
 * @package_name com.ssh.web
 * @desc TODO
 * @param
 * @author jack
 * @date 2013-4-28
 * @time 下午9:00:58
 */
package com.ssh.web;

import org.apache.struts2.ServletActionContext;

import com.opensymphony.xwork2.ActionSupport;
import com.ssh.entity.Staff;
import com.ssh.ser.staffInfo.StaffInfoServiceI;

/**
 * @author jack
 *
 */
public class ShowMyProfileAction extends ActionSupport{
	/**
	 *
	 */
	private static final long serialVersionUID = 1L;
	private String request;
	public Staff staff;
	private StaffInfoServiceI staffInfoServiceI;

	@Override
	public String execute() throws Exception {
		// TODO Auto-generated method stub
		String staffId = (String) ServletActionContext.getContext()
				.getSession().get("staffId");
	    Staff staff = staffInfoServiceI.editViewStaffInfo(staffId);
		setStaff(staff);
		ServletActionContext.getContext().getSession().put("staff", this.getStaff());
		System.out.println("staff viewStaffAction "+this.getStaff());
		if (this.getStaff() != null)
			if (request.equals("1"))
				return "profile";
			else if (request.equals("2"))
				return "personalMessage";
		return "error";
	}


	/**
	 * @return the request
	 */
	public String getRequest() {
		return request;
	}


	/**
	 * @param request the request to set
	 */
	public void setRequest(String request) {
		this.request = request;
	}


	/**
	 * @return the staff
	 */
	public Staff getStaff() {
		return staff;
	}

	/**
	 * @return the staffInfoServiceI
	 */
	public StaffInfoServiceI getStaffInfoServiceI() {
		return staffInfoServiceI;
	}

	/**
	 * @param staff
	 *            the staff to set
	 */
	public void setStaff(Staff staff) {
		this.staff = staff;
	}

	/**
	 * @param staffInfoServiceI
	 *            the staffInfoServiceI to set
	 */
	public void setStaffInfoServiceI(StaffInfoServiceI staffInfoServiceI) {
		this.staffInfoServiceI = staffInfoServiceI;
	}

}
